package com.chijun.mform.create.field;

import android.content.Context;
import android.view.ViewGroup;

import com.chijun.mform.R;
import com.chijun.mform.create.mode.FormField;
import com.example.ccj.u.ToastUtils;

public class FieldHandler {
    /**
     * 获取字段类型默认图标
     * @param formField 字段属性
     * @return 该字段的
     */
    public static int getFieldIcon(int formField){

        switch (formField) {
            //单行文字 1
            case FormField.TEXT_ONE:
                return R.drawable.field_icon_danhangshuru;
            //多行文字 2
            case FormField.TEXT_MULTI:
                return R.drawable.field_icon_duohangshuru;
            //单项选择 3
            case FormField.DAN_XUAN:
                return R.drawable.field_icon_danxuan;
            //多项选择 4
            case FormField.DUO_XUAN:
                return R.drawable.field_icon_duoxuan;
            //数字 5
            case FormField.SHU_ZI:
                return R.drawable.field_icon_shuzishuru;
            //日期 6
            case FormField.RI_QI:
                return R.drawable.field_icon_riqixuanze;
            //日期区间 7
            case FormField.RI_QI_QU_JIAN:
                return R.mipmap.form_field_date;
            //说明文字 8
            case FormField.SHUO_MING_WEN_ZI:
                return R.drawable.field_icon_tishifu;
            //身份证 9
            case FormField.SHEN_FEN_ZHENG:
                return R.drawable.field_icon_jilianxuanze;
            //图片 10
            case FormField.TU_PIAN:
                return R.drawable.field_icon_jingtaitupian;
            //金额 11
            case FormField.JIN_E:
                return R.drawable.field_icon_jine;
            //附件 12
            case FormField.FU_JIAN:
                return R.drawable.field_icon_fujian;
            //经纬度 13
            case FormField.JING_WEI_DU:
                return R.drawable.field_icon_chaolianjie;
            //计算公式 14
            case FormField.JI_SUAN_GONG_SHI:
                return R.drawable.field_icon_jisuanzujian;
            //联系人 15
            case FormField.LIAN_XI_REN:
                return R.drawable.field_icon_yonghuxuanze;
            //手写 16
            case FormField.SHOU_XIE:
                return R.drawable.field_icon_jingtaitupian;
            //关联其他表单 17
            case FormField.GUAN_LIAN_BIAO_DAN:
                return R.drawable.field_icon_biaoge;
            //二维码 18
            case FormField.ER_WEI_MA:
                return R.drawable.field_icon_erweima;
            default:
                ToastUtils.showShort("不支持的字段" + formField);
                return  R.mipmap.default_field_icon;

        }
    }

    /**
     * 处理表单字段获取填写控件
     * @param context 上下文
     * @param formField 字段属性
     * @return 该字段的
     */
    public static ViewGroup handlerField(Context context, FormField formField){


        switch (formField.getType()) {
            //单行文字
            case FormField.TEXT_ONE:
                break;
            //多行文字
            case FormField.TEXT_MULTI:
                break;
            //单项选择
            case FormField.DAN_XUAN:
                break;
            //多项选择
            case FormField.DUO_XUAN:
                break;
            //数字
            case FormField.SHU_ZI:
                break;
            //日期
            case FormField.RI_QI:
                break;
            //日期区间
            case FormField.RI_QI_QU_JIAN:
                break;
            //说明文字
            case FormField.SHUO_MING_WEN_ZI:
                break;
            //身份证
            case FormField.SHEN_FEN_ZHENG:
                break;
            //图片
            case FormField.TU_PIAN:
                break;
            //金额
            case FormField.JIN_E:
                break;
            //附件
            case FormField.FU_JIAN:
                break;
            //经纬度
            case FormField.JING_WEI_DU:
                break;
            default:
                ToastUtils.showShort("不支持的字段" + formField.getType());
                return null;

        }
        return null;
    }




    public static void getFormFieldDefaultConfig(FormField formField){


        switch (formField.getType()) {
            //单行文字
            case FormField.TEXT_ONE:
            //多行文字
            case FormField.TEXT_MULTI:

                break;
            //单项选择
            case FormField.DAN_XUAN:

                break;
            //多项选择
            case FormField.DUO_XUAN:
                break;
            //数字
            case FormField.SHU_ZI:

                break;
            //日期
            case FormField.RI_QI:
                break;
            //日期区间
            case FormField.RI_QI_QU_JIAN:
                break;
            //说明文字
            case FormField.SHUO_MING_WEN_ZI:
                break;
            //身份证
            case FormField.SHEN_FEN_ZHENG:

                break;
            //图片
            case FormField.TU_PIAN:
                break;
            //金额
            case FormField.JIN_E:

                break;
            //附件
            case FormField.FU_JIAN:
                break;
            //经纬度
            case FormField.JING_WEI_DU:

                break;
            default:
                ToastUtils.showShort("不支持的字段" + formField.getType());
                return ;
        }


    }



}
